﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Generico.Coneccion;
using Administracion.ar.com.rofex.ws;
using System.Globalization;

namespace Administracion
{
    public partial class News : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var _FileBrowser1 = new CKFinder.FileBrowser { BasePath = "../ckfinder/" };
            _FileBrowser1.SetupCKEditor(this.txtContenido);

            if (!this.IsPostBack)
            {
       

                CargarLista();
                if (lstInfo.Items.Count >= 1)
                {
                    this.lstInfo.SelectedIndex = 0;
                    cargardatos(Convert.ToInt32(lstInfo.SelectedValue));
                }
                Habilitar(true);
            }
        }



        protected void lstInfo_SelectedIndexChanged1(object sender, EventArgs e)
        {
            if (lstInfo.SelectedValue != String.Empty)
            {
                cargardatos(Convert.ToInt32(lstInfo.SelectedValue));
            }
            
        }
        private void cargardatos(int valor)
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            string sql = "Select id, Nombre, Fecha, Estado, Asunto, HTML FROM NewsLetter where Id = " + valor.ToString();
            var rd = cn.EjecutarSqlDataReader(sql);
            while (rd.Read())
            {
                txtId.Text = rd["id"].ToString();
                txtNombre.Text = rd["Nombre"].ToString();
                txtFecha.Text = rd["Fecha"].ToString();
                txtEstado.Text = rd["Estado"].ToString();
                txtAsunto.Text = rd["Asunto"].ToString();
                txtContenido.Text = rd["HTML"].ToString();
            }
            rd.Close();
            cn.Cerrar();
        }

        protected void Button3_Click(object sender, EventArgs e)
        {

        }

        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            Limpiar();
            Visualizar(true);
            Habilitar(false);
            this.Session.Add("Transaccion", "A");
        }

        private void Limpiar()
        {
            txtId.Text = "";
            txtNombre.Text = "";
            txtFecha.Text = "";
            txtEstado.Text = "";
            txtAsunto.Text = "";
            txtContenido.Text = "";
        }
        private void Visualizar(bool visible)
        {
            btnAceptar.Visible = visible;
            btnCancelar.Visible = visible;
        }
        private void Habilitar(bool habilitado)
        {
            btnModificar.Enabled = habilitado;
            btnAgregar.Enabled = habilitado;
            btnEliminar.Enabled = habilitado;
            txtId.Enabled = !habilitado;
            txtNombre.Enabled = !habilitado;
            txtFecha.Enabled = !habilitado;
            txtEstado.Enabled = !habilitado;
            txtAsunto.Enabled = !habilitado;
            txtContenido.Enabled = !habilitado;
        }

        protected void btnModificar_Click(object sender, EventArgs e)
        {
            Visualizar(true);
            Habilitar(false);
            this.Session.Add("Transaccion", "M");
        }

        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            string varTransaccion = Session["Transaccion"].ToString();
            
            var cn = new ClsConeccion();
            cn.Abrir();

            txtContenido.Text = txtContenido.Text.Replace("TablaMervaros", TablaMervaros());
            txtContenido.Text = txtContenido.Text.Replace("TablaMoneda", TablaMoneda());
            txtContenido.Text = txtContenido.Text.Replace("TablaIndices",TablaIndices());
            txtContenido.Text = txtContenido.Text.Replace("TablaRofex", TablaRofex());
            txtContenido.Text = txtContenido.Text.Replace("TablaTitulosPublicos", TablaTituloPublicos());

            
            if (varTransaccion == "A")
            {
                cn.AgregarParametros("Nombre", txtNombre.Text);
                cn.AgregarParametros("Fecha", Convert.ToDateTime(txtFecha.Text));
                cn.AgregarParametros("Estado", "PENDIENTE");
                cn.AgregarParametros("Asunto", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(txtAsunto.Text.ToLower()));
                cn.AgregarParametros("HTML", txtContenido.Text);
                cn.EjecutarSp("sp_ADM_NewNewsLetter");
                CargarLista();
            }

            if (varTransaccion == "M")
            {
                cn.AgregarParametros("Nombre", txtNombre.Text);
                cn.AgregarParametros("Fecha", Convert.ToDateTime(txtFecha.Text));
                cn.AgregarParametros("Estado", txtEstado.Text);
                cn.AgregarParametros("Asunto", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(txtAsunto.Text.ToLower()));
                cn.AgregarParametros("HTML", txtContenido.Text);
                cn.AgregarParametros("id", Convert.ToInt32(txtId.Text));
                cn.EjecutarSp("sp_ADM_UpdateNewsLetter");
            }
            cn.Cerrar();
            Response.Write("<script> alert('Se ha guardado correctamente');</script>");
            Visualizar(false);
            
            Habilitar(true);
        }

        protected void btnCancelar_Click(object sender, EventArgs e)
        {

            Limpiar();
            Visualizar(false);
            Habilitar(true);
        }

        private void CargarLista()
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            string sql = "Select id, Nombre FROM NewsLetter ";

            var rd = cn.EjecutarSqlDataReader(sql);
            var dt = new DataTable();
            dt.Load(rd);
            this.lstInfo.DataSource = dt;
            this.lstInfo.DataTextField = "Nombre";
            this.lstInfo.DataValueField = "id";
            this.lstInfo.DataBind();
            cn.Cerrar();
        }

        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            cn.EjecutarSql("Delete NewsLetter where Id = " + txtId.Text);
            cn.Cerrar();
            Response.Write("<script> alert('Se ha elimando correctamente');</script>");
            CargarLista();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            string sql = "Select Asunto, HTML FROM NewsLetter where id =  " + txtId.Text;
          
            var rd = cn.EjecutarSqlDataReader(sql);

            string asunto = "";
            string HTML = "";
            while (rd.Read())
            {
                asunto = rd["Asunto"].ToString();
                
                HTML = rd["HTML"].ToString();
            }
            rd.Close();
            cn.Cerrar();

            var correo = new System.Net.Mail.MailMessage
            {
                From = new System.Net.Mail.MailAddress("info@rosariofinanzas.com.ar")
            };
            correo.To.Add("info@rosariofinanzas.com.ar");
            correo.To.Add("pablogarcia222@hotmail.es");
            correo.Subject = asunto;
            correo.Body = HTML;
            correo.IsBodyHtml = true;
            correo.Priority = System.Net.Mail.MailPriority.Normal;
            var smtp = new System.Net.Mail.SmtpClient
            {
                Host = "mail.rosariofinanzas.com.ar",
                Credentials =
                    new System.Net.NetworkCredential("info@rosariofinanzas.com.ar", "Info123456")
            };
            smtp.Send(correo);
            this.RegisterStartupScript("Cartel", "<script>alert('NewsLetter Enviado')</script>");
        }

        protected void btnDuplicar_Click(object sender, EventArgs e)
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            string sql = "Insert Into NewsLetter Select Nombre, Fecha, Estado, HTML, Asunto FROM NewsLetter where Id = " +   txtId.Text;
            cn.EjecutarSql(sql);
            cn.Cerrar();
            lstInfo.Items.Clear();
            CargarLista();

            this.RegisterStartupScript("Cartel", "<script>alert('NewsLetter se ha duplicado')</script>");
        }

        private string TablaMervaros()
        {
            
            string html = "";
            html += "<table " + claseTabla() + " >";
            html += "<tr " + claseTitulo() +  " >";
            html += "<td width=\"100%\" colspan=\"3\">MERVAROS</td>";
            html += "</tr>";


            var dt = dtTablas("TablasMervaros");
            foreach (DataRow dr in dt.Rows)
            {
                html += "<tr>";
                html += "<td " + claseFila() + " colspan=\"2\">" + dr["Descripcion"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + (Convert.ToDouble(dr["Indice1"]) * 100).ToString("f2") + "%" + "</td>";
                html += "</tr>";
            }
            html += "</table>";
            return html;
        }

        private string TablaMoneda()
        {
            var dt = dtTablas("Moneda");
            
            string html = "";
            html += "<table " +  claseTabla()+ ">";
            html += "<tr " + claseTitulo () + ">";
            html += "<td width=\"100%\" colspan=\"4\">Moneda</td>";
            html += "</tr>";

            foreach (DataRow dr in dt.Rows)
            {
                html += "<tr>";
                html += "<td " + claseFila() + " colspan=\"2\">" + dr["varMoneda"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + dr["Compra"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + dr["Venta"].ToString() + "</td>";
                html += "</tr>";
            }

            html += "</table>";
            return html;
        }
     private string TablaIndices ()
     {
         var dt = dtTablas("TablasIndices");
            string html = "";
            html += "<table " +claseTabla() + " >";
            html += "<tr "+ claseTitulo() +  " >";
            html += "<td width=\"100%\" colspan=\"4\">INDICES</td>";
            html += "</tr>";

            foreach (DataRow dr in dt.Rows)
            {
                html += "<tr>";
                html += "<td " + claseFila() + " colspan=\"2\">" + dr["descripcion"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + Convert.ToDouble(dr["Indice1"]).ToString("f2") + "</td>";
                html += "<td " + claseFila() + ">" + (Convert.ToDouble(dr["Indice2"]) * 100).ToString("f2") + " %" + "</td>";
                html += "</tr>";
            }

            html += "</table>";
            return html;
    }
     private string TablaRofex()
     {


         var dt = DTROFEX();
         string html = "";
         html += "<table "  + claseTabla() + " >";
         html += "<tr " + claseTitulo() + " >";
         html += "<td width=\"100%\" colspan=\"4\">ROFEX</td>";
         html += "</tr>";

            foreach (DataRow dr in dt.Rows)
            {
                html += "<tr>";
                html += "<td " + claseFila() + " colspan=\"2\">" + dr["descripcion"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + Convert.ToDouble(dr["Indice1"]).ToString("f2") + "</td>";
                html += "<td " + claseFila() + ">" + (Convert.ToDouble(dr["Indice2"]) * 100).ToString("f2") + " %" + "</td>";
                html += "</tr>";
            }

            
         /*
         dt = dtTablas("TablasRofexdda");
         html += "<tr " + claseTitulo() + " >";
         html += "<td width=\"100%\" colspan=\"4\">ROFEX DDA</td>";
         html += "</tr>";

       foreach (DataRow dr in dt.Rows)
            {
                html += "<tr>";
                html += "<td " + claseFila() + " colspan=\"2\">" + dr["descripcion"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + Convert.ToDouble(dr["Indice1"]).ToString("f2") + "</td>";
                html += "<td " + claseFila() + ">" + (Convert.ToDouble(dr["Indice2"]) * 100).ToString("f2") + " %" + "</td>";
                html += "</tr>";
            }*/

         html += "</table>";

         return html;
     }
        private string TablaTituloPublicos()
        { 
            
            var     dt = dtTablas("TablasTitulosPublicos");
            string html = "";
        html += "<table " + claseTabla() + ">";
        html += "<tr " + claseTitulo() + ">";
            html += "<td width=\"100%\" colspan=\"4\">Titulos Publicos</td>";
            html += "</tr>";


             foreach (DataRow dr in dt.Rows)
            {
                html += "<tr>";
                html += "<td " + claseFila() + " colspan=\"2\">" + dr["descripcion"].ToString() + "</td>";
                html += "<td " + claseFila() + ">" + Convert.ToDouble(dr["Indice1"]).ToString("f2") + "</td>";
                html += "<td " + claseFila() + ">" + (Convert.ToDouble(dr["Indice2"]) * 100).ToString("f2") + " %" + "</td>";
                html += "</tr>";
            }
            

            html += "</table>";
            return html;
        }
        private string claseTabla ()
        {
            string Clase = "style=\"width:100%;	background-color: White;border-color:Black;	border-style:solid;	border-width:thin;border-collapse:collapse;\"";
            return Clase;
        }
        private string claseTitulo()
        {
            string clase = "style=\"text-align:center;background-color:#f3eee1;color:#515151;font-weight:bold;\"";
            return clase;
        }
        private string claseFila ()
        {
            string clase = "Style=\"border-color:Black;border-bottom-style:solid;border-left-style:solid;border-width:thin;text-align:center;	padding:0;	font-family:@Arial Unicode MS;	font-size:12px;\"";
            return clase;
        }

        private DataTable dtTablas(string TipoTabla)
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            string sql= string.Empty;
            switch (TipoTabla)
            {
                case "Moneda":
                    sql = "Select varMoneda, '$' + Replace (Cast(Cast(PromedioRFCompra as Numeric(9,3)) as varchar),'.',',')  Compra, '$' + Replace (Cast(Cast(PromedioRFVenta as Numeric(9,3)) as varchar),'.',',')  Venta From Promedios P ";
                    sql += "inner Join  (Select Moneda, Max(Fecha) fec From Promedios ";
                    sql += "group by Moneda) P1 on P1.Moneda = P.Moneda and P1.Fec = P.Fecha ";
                    sql += "Inner Join Monedas M on P.Moneda = M.idMoneda order by P.Moneda ";
                    break;
                case "TablasMervaros":
                    sql = " ";
                    sql += " Select Descripcion, Indice1 FROM (Select TOP 4 I.varDescripcion + ' ' + Plazo Descripcion, [Tasa Ult] Indice1 FROM dbo.MervaRosCauciones MRC  ";
                    sql += " INNER JOIN dbo.Indice I ON MRC.intIndice = I.intIndice ";
                    sql += " WHERE Fecha = (Select MAx(Fecha) FROM MervaRosCauciones) ";
                    sql += " ORDER BY vto ) X ";
                    sql += " Union  ";
                    sql += " Select Descripcion, Indice1 FROM (Select Top 4 I.varDescripcion + ' ' + Plazo Descripcion, TasaPromedio Indice1 FROM dbo.MervaRosCheques MRC  ";
                    sql += " INNER JOIN dbo.Indice I ON MRC.intIdIndice = I.intIndice ";
                    sql += " WHERE MRC.intIdIndice = 2 ";
                    sql += " AND Fecha = (Select MAx(Fecha) FROM MervaRosCheques WHERE intIdIndice = 2) ";
                    sql += " ORDER BY vto ) X1 ";
                    sql += " Union  ";
                    sql += " Select Descripcion, Indice1 FROM (Select Top 4 I.varDescripcion + ' ' + Plazo Descripcion, TasaPromedio Indice1 FROM dbo.MervaRosCheques MRC  ";
                    sql += " INNER JOIN dbo.Indice I ON MRC.intIdIndice = I.intIndice ";
                    sql += " WHERE MRC.intIdIndice = 5 ";
                    sql += " AND Fecha = (Select MAx(Fecha) FROM MervaRosCheques WHERE intIdIndice = 5) ";
                    sql += " ORDER BY vto ) X2 ";
                    break;
                case "TablasIndices":
                case "TablasRofexddf":
                case "TablasRofexdda":
                case "TablasTitulosPublicos":
                    sql = "Select * From Tablas where Tipo = '" + TipoTabla + "'";
                    sql += " and Fecha in (Select Max(Fecha) From Tablas where Tipo = '" + TipoTabla +"')";
                    break;


            }
            
            var sqldr2 = cn.EjecutarSqlDataReader(sql);
            var dt = new DataTable();
            dt.Load(sqldr2);
            cn.Cerrar();
            return dt;
        }

        private DataTable DTROFEX()
        {
            var cn = new ClsConeccion();
            cn.Abrir();
            string sql = "Select * FROM ConfigRofexNews where Seleccionado  = 1 order by IdProducto";

            var rd = cn.EjecutarSqlDataReader(sql);

            cn.Cerrar();
            var dt = new DataTable();
            dt.Load(rd);
            var obj = new ROFEXWebService();
            var auxProducto = string.Empty;
            DataSet ds = new DataSet();

            DataTable dtRofex = new DataTable();
            dtRofex.Columns.Add("Descripcion", "".GetType());
            dtRofex.Columns.Add("Indice1", 2.3.GetType());
            dtRofex.Columns.Add("Indice2", 2.3.GetType());

            foreach (DataRow dr in dt.Rows)
            {
                if (auxProducto !=dr["idProducto"].ToString())
                {
                    ds = obj.MarketData(1, DateTime.Today, DateTime.Today, "", Convert.ToInt32(dr["idProducto"].ToString()));
                    auxProducto= dr["idProducto"].ToString();
                }
                DataRow[] drAUX = ds.Tables[0].Select("Posicion = '" + dr["Posicion"].ToString() + "'");
                DataRow[] dr1 = ds.Tables[1].Select("Posicion = '" + dr["Posicion"].ToString() + "'");
                if (drAUX.Length > 0 && dr1.Length > 0)
                {
                    dtRofex.Rows.Add(
                        drAUX[0]["Producto"].ToString() + "-" + dr["Posicion"].ToString(),
                        dr1[0]["Precio"],
                        dr1[0]["Variacion"]
                        );
                }

            }
            return dtRofex;
        }
        

        protected void btnTablas_Click(object sender, EventArgs e)
        {
         
            
            string tablagral = "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 100%;\">";
            tablagral += "<tr><td>TablaRofex <br>TablaIndices<br>TablaMoneda </td><td>TablaMervaros <br>TablaTitulosPublicos</td></tr>";
            tablagral += "</table>";
            txtContenido.Text = txtContenido.Text.Replace("GENERARTABLAS", tablagral);
            txtContenido.Text = txtContenido.Text.Replace("TablaMervaros", TablaMervaros());
            txtContenido.Text = txtContenido.Text.Replace("TablaMoneda", TablaMoneda());
            txtContenido.Text = txtContenido.Text.Replace("TablaIndices",TablaIndices());
            txtContenido.Text = txtContenido.Text.Replace("TablaRofex", TablaRofex());
            txtContenido.Text = txtContenido.Text.Replace("TablaTitulosPublicos", TablaTituloPublicos());
        }


        private string GetHtmlCabeceraNewsletter(string fecha)
        {

            string html = "";

            html += "<div style=\"padding: 30px; height: auto; background-color: rgb(243, 238, 225);\">";
            html += "<div style=\"text-align: center;\">";
            html += "</div>";
            html += "<div style=\"text-align: center; background-color: white;\">";
            html += "<div style=\"width: 100%; height: 20px; background-color: rgb(141, 105, 13);\">";
            html += "</div>";
            html += "<table style=\"width: 96%; height: 120px; text-align: left; margin-top: 10px; margin-right: 2%; margin-left: 2%; border-bottom-color: rgb(141, 105, 13); border-bottom-width: 3px; border-bottom-style: double; background-color: white;\">";
            html += "<tbody>";
            html += "<tr>";
            html += "<td>";
            html += " <img alt=\"Logo Rosario Finanzas\" border=\"0\" src=\"http://rosariofinanzas.com.ar/ckfinder/images/RosarioNews.jpg\" style=\"width: 174px; height: 44px;\" /></td>";
            html += "<td style=\"text-align: right;\">";
            html += "<span id=\"fecha\" style=\"font-family: arial,helvetica,sans-serif; font-size: 24px;\">" + fecha + "</span><br />";
            html += "<span style=\"font-family: arial,helvetica,sans-serif; font-size: 24px;\">news<strong>letter</strong></span><br />";
            html += "<br />";
            html += "<span style=\"color: black; font-family: arial,helvetica,sans-serif; font-size: 14px;\"><a href=\"http://rosariofinanzas.com.ar\" style=\"text-decoration: none;\">www.rosariofinanzas.com.ar</a></span></td>";
            html += "</tr>";
            html += "<tr>";
            html += "<td>";
            html += "</td>";
            html += "<td style=\"text-align: right;\">";
            html += "</td>";
            html += "</tr>";
            html += "</tbody>";
            html += "</table>";

            return html;
        }

        private string GetHtmlPiePaginaNewsletter()
        {

            string html = "";

            html += "<p>";
            html += " Si no desea seguir recibiendo este correo, por favor, env&iacute;e un mail haciendo click aqu&iacute;&nbsp;<a href=\"mailto:info@rosariofinanzas.com.ar\">info@rosariofinanzas.com.ar</a>&nbsp;con el t&iacute;tulo &quot;REMOVER&quot;</p>";
            html += "<div style=\"padding: 10px; height: 100px; text-align: right; background-color: rgb(141, 105, 13);\">";
            html += "<a href=\"https://www.facebook.com/pages/Rosario-Finanzas/197698343618378\" target=\"_blank\"><img alt=\"Facebook\" border=\"0\" src=\"http://rosariofinanzas.com.ar/ckfinder/images/face.png\" style=\"border-width: 0px; border-style: solid; width: 23px; height: 22px;\" /></a> <a href=\"https://twitter.com/rosariofinanzas\" target=\"_blank\"> <img alt=\"Twitter\" border=\"0\" src=\"http://rosariofinanzas.com.ar/ckfinder/images/twit.png\" style=\"border-width: 0px; border-style: solid; width: 23px; height: 22px;\" /></a></div>";
            html += "</div>";
            html += "</div>";
            html += "<p>";
            html += "</p>";


            return html;
        }

        private string GetHtmlNoticiaNewsletter(string titulo, string resumen, string url)
        {

            string html = "";

            html += "<table align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" style=\"width: 459px; margin-top: 10px;\">";
            html += "<tbody>";
            html += "<tr>";
            html += "<td>";
            html += "<p id=\"titulo\">";
            html += "<strong>" + titulo + "</strong></p>";
            html += "</td>";
            html += "<td style=\"width: 338px;\">";
            html += "<p id =\"resumen\">" + resumen;
            html += "</p>";
            html += "<p>";
            html += "<a href=\"" + url + "\" target=\"_blank\">" + url +"</a></p>";
            html += "</td>";
            html += "</tr>";
            html += "</tbody>";
            html += "</table>";

            return html;
        }

        private string GetHtmlArticuloSugeridoNewsletter(string titulo, string resumen, string url)
        {

            string html = "";

            html += "<table align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" style=\"width: 459px; margin-top: 10px;\">";
            html += "<tbody>";
            html += "<tr>";
            html += "<td>";
            html += "<p><b>ART&Iacute;CULO&nbsp;</b><br /><strong>SUGERIDO:&nbsp;</strong></p>";
            html += "<p id=\"titulo\">";
            html += "<strong>" + titulo + "</strong></p>";
            html += "</td>";
            html += "<td style=\"width: 338px;\">";
            html += "<p id =\"resumen\">" + resumen;
            html += "</p>";
            html += "<p>";
            html += "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a></p>";
            html += "</td>";
            html += "</tr>";
            html += "</tbody>";
            html += "</table>";

            return html;
        }

        private string GetHtmlInformeSugeridoNewsletter(string titulo, string resumen, string url)
        {

            string html = "";

            html += "<table align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" style=\"width: 459px; margin-top: 10px;\">";
            html += "<tbody>";
            html += "<tr>";
            html += "<td>";
            html += "<p><b>INFORME&nbsp;</b><br /><strong>SUGERIDO:&nbsp;</strong></p>";
            html += "<p id=\"titulo\">";
            html += "<strong>" + titulo + "</strong></p>";
            html += "</td>";
            html += "<td style=\"width: 338px;\">";
            html += "<p id =\"resumen\">" + resumen;
            html += "</p>";
            html += "<p>";
            html += "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a></p>";
            html += "</td>";
            html += "</tr>";
            html += "</tbody>";
            html += "</table>";

            return html;
        }
            
    }
}
